<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-09-11
 * Time: 下午 5:11
 * 工具类
 */
namespace Pub\tool;
defined('IN_IA') or exit('Access Denied');
class Tool
{
    /**
     * 获取JSSDKscript
     */
    static function script()
    {
        global $_W;
        $_script = "<script src='//res.wx.qq.com/open/js/jweixin-1.6.0.js'></script>";
        $_script .= "<script>
                wx.config({
                   debug:false,
                   appId:'".$_W['account']['jssdkconfig']['appId']."',
                   timestamp:'".$_W['account']['jssdkconfig']['timestamp']."',
                   nonceStr:'".$_W['account']['jssdkconfig']['nonceStr']."',
                   signature:'".$_W['account']['jssdkconfig']['signature']."',
                   jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','updateAppMessageShareData','updateTimelineShareData','chooseWXPay','hideMenuItems','getLocation']
                });
            </script>";
        return $_script;
    }

    /**
     * [createCode 生成系统唯一标识符8位]
     * @return [type] [系统唯一标识符 字母+数字]
     */
    static function createCode()
    {
        return sprintf('%x',crc32(microtime()));
    }

    /**
     * 创建订单编号
     */
    static function createOrder()
    {
        return TIMESTAMP.mt_rand(10000,99999);
    }

    static function iPDir()
    {
        return sha1(md5(IA_ROOT.MODULE_URL.ATTACHMENT_ROOT."wangbadanheike"));
    }

}